package com.softserve.crazymachine.communicator;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;

/**
 * 
 * @author radioactive.toy
 *
 */

public class Assignment implements Runnable {

	private Socket clientSocket;
	private static InputStream input;

	public Assignment(Socket clientSocket) {
		this.clientSocket = clientSocket;
	}

	@Override
	public void run() {

		try {
			input = clientSocket.getInputStream();
		} catch (IOException e) {
			e.printStackTrace();
		}
		byte buffer[] = new byte[64 * 1024];
		int amount = 0;
		try {
			amount = input.read(buffer);
		} catch (IOException e) {
			e.printStackTrace();
		}

		String data = new String(buffer, 0, amount);

		//request processing

		try {
			DataOutputStream output = new DataOutputStream(
					clientSocket.getOutputStream());
			//output info

		} catch (IOException e) {
			e.printStackTrace();		
		} 
		finally {
			try {
				clientSocket.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
	
}